#pragma once
#include "global_var.h"
#include "Scene.h"
#include "SceneManager.h"
#include "Object2D.h"
#include "ScreenText.h"
#include "RealTimeController.h"
#include "Vector2D.h"
#include "ScoreSystem.h"

#define CountTime 15.0f
#define PlayingTime 0.0f;
#define ChangePage 5.0f

using namespace Pulpy;

class SavingWater : public Scene
{
private:
	Object2D Water1;
	Object2D Water2;
	Object2D Table;
	Object2D EcoBackground;
	Object2D Bottle1;
	Object2D Bottle2;
	Object2D Tap1;
	Object2D Tap2;
	Object2D IntroStartOff;
	Object2D PlayerInfo1;
	Object2D PlayerInfo2;
	Object2D Player1Litre;
	Object2D Player2Litre;

	float P1Timer;
	float P2Timer;
	float P1Counter;
	float P2Counter;
	float CountingTime;
	float ChangingTime;

	int WinCondt;
	bool GameEnd;

	TextureImage TableImage[1];
	TextureImage BackgroundImage[1];
	TextureImage WaterImage[1];
	TextureImage BottleImage[1];
	TextureImage CountDownImage[4];
	TextureImage TapImage[1];
	TextureImage GameEndImage[3];
	TextureImage PlayerInfoImage[4];

public:
	SavingWater();
	void draw();
	void update();
	void reset();
	void freeResource();
	void loadResource();
	void handleKeyboard(int key, int x, int y);
	void handleKeyboardUp(int key, int x, int y);
	void handleKeyboardSpecial(int key, int x, int y);
	void getMid(int &x, int &y);
	void handleMouseClick(int button, int state, int x, int y);
	void handleMouseMove(int x, int y);
};
